/*
 * Card.java
 * 
 * Class to store a card.
 */
public class Card {

	private String name;	// Card name (i.e. A,10,K,Q,J, or 9)
	private String suit;	// Card's suit (hearts,spades,...)
	private int rank;		// rank determined by rank() method below
	
	// Rank of Cards Pinochle
	private final int ace = 10;
	private final int ten = 9;
	private final int king = 8;
	private final int queen = 7;
	private final int jack = 6;
	private final int nine = 5;
	private final int clubs = 4;
	private final int hearts = 3;
	private final int spades = 2;
	private final int diamonds = 1;
	
	// Constructor
	public Card(String n, String s){
		name = n;
		suit = s;
		rank = calcRank(name,suit);
	}
	
	/*
	 * Calculates the rank of the card.  Based on how the numbers
	 * are defined, the cards will be ordered by suit high to low.
	 * Suit order will always be clubs, hearts, spades, then diamonds.
	 */
	private static int calcRank(String name, String suit){
		int rank = 0;
		if(name.equals("A")) {rank = 10;}
		if(name.equals("10")) {rank = 9;}
		if(name.equals("K")) {rank = 8;}
		if(name.equals("Q")) {rank = 7;}
		if(name.equals("J")) {rank = 6;}
		if(name.equals("9")) {rank = 5;}
		if(suit.equals("clubs")) {rank = rank + 70;}
		if(suit.equals("hearts")) {rank = rank + 50;}
		if(suit.equals("spades")) {rank = rank + 30;}
		if(suit.equals("diamonds")) {rank = rank + 10;}
		
		return rank;
	}
	
	// Returns the rank
	public int showRank(){
		return rank;
	}
	
	public String toString(){
		return name + " " + suit;
	}
	
	public static void main(String[] args) {
		

	}

}
